package org.vacoor.nothing.security.lucene;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.facet.FacetField;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.NIOFSDirectory;
import org.apache.lucene.util.Version;

import java.io.File;
import java.io.IOException;

//import org.wltea.analyzer.lucene.IKAnalyzer;

/**
 * Created by Administrator on 2014/11/12.
 */
public class IndexRebuilder {
    private Directory dir;//new RAMDirectory();
    private Analyzer analyzer = new StandardAnalyzer();
//    private Analyzer analyzer = new IKAnalyzer();
    private Version matchedVersion = Version.LUCENE_47;

    public IndexRebuilder() throws IOException {
        // throw new IllegalStateException("就是不让你创建");
        //dir = NIOFSDirectory.open(new File("c:/lucene/index"));
    }

    public void buildFacetIndecis() throws IOException {
//        IndexWriterConfig indexWriterConfig = new IndexWriterConfig(matchedVersion, analyzer);
//        IndexWriter indexWriter = new IndexWriter(dir, indexWriterConfig);
        /*
        DirectoryTaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter(dir);

        Document doc = new Document();
        new FacetField("", "");

        taxonomyWriter.commit();
        taxonomyWriter.close();
        */
        System.out.println("build indecis ....");
    }
}
